export interface User {
    id: string;
    name: string;
    email: string;
    title: string;
    organization: string;
    token: string;
}

interface SearchePanelProps {
    users: User[];
    param: {
        name: string;
        personId: string;
    };
    setParam: (params: SearchePanelProps["param"]) => void;
}

export const SearchePanel = ({ param, setParam, users }: SearchePanelProps) => {
    return (
        <form action="">
            <div>
                <input
                    type="text"
                    value={param.name}
                    onChange={(e) =>
                        setParam({
                            ...param,
                            name: e.target.value,
                        })
                    }
                />
            </div>
            <select
                value={param.personId}
                onChange={(e) => {
                    setParam({
                        ...param,
                        personId: e.target.value,
                    });
                }}
            >
                <option value={""}>负责人</option>
                {users.map((user) => (
                    <option value={user.id} key={user.id}>
                        {user.name}
                    </option>
                ))}
            </select>
        </form>
    );
};
